package cn.iocoder.yudao.module.system.controller.admin.cp.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.ArrayList;
import java.util.List;

@Getter
@AllArgsConstructor
public enum ProcessEnum {
    PROCESS("process", "请假"),
    OFFICIAL("official", "出差"),
    EGRESS("egress", "外出");
    private final String type;
    private final String desc;

    /**
     * 获取所有类型,返回List<String>
     */
    public static List<String> getAllTypes() {
        List<String> types = new ArrayList<>();
        for (ProcessEnum value : ProcessEnum.values()) {
            types.add(value.getType());
        }
        return types;
    }

    /**
     * 根据类型获取描述
     */
    public static String getDescByType(String type) {
        for (ProcessEnum value : ProcessEnum.values()) {
            if (value.getType().equals(type)) {
                return value.getDesc();
            }
        }
        return null;
    }

}
